package murraco.controller;

import murraco.common.Result;
import murraco.security.MyUserDetail;
import murraco.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/records")
@CrossOrigin
public class RecordController {

    @Autowired
    private RecordService recordService;

    @GetMapping
    public Result getRecordListLimit10(@AuthenticationPrincipal MyUserDetail userDetail){
        return Result.success(recordService.getRecordListLimit10(userDetail.getUserId()));
    }
}
